package top.yuzt.noticeserver.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.yuzt.noticeserver.entity.Groupmembers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.yuzt.noticeserver.entity.Users;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yuzt
 * @since 2024-05-05
 */
@Mapper
public interface GroupmembersMapper extends BaseMapper<Groupmembers> {
    @Select("SELECT * FROM Groupmembers WHERE UserID = #{userID}")
    List<Groupmembers> findGroupByUserid(String userID);

    @Select("SELECT * FROM Groupmembers WHERE GroupID = #{groupID}")
    List<Groupmembers> findUserByGroupid(String groupID);

    @Select("SELECT * FROM Groupmembers WHERE GroupID = #{groupid} AND UserID = #{userid} ")
    Groupmembers findByGroupIdAndUserId(@Param("groupid") Integer groupId, @Param("userid") Integer userId);
}


